# -*- coding: utf-8 -*-

def decorator():
    def _deco(func):
        def _func(self, *args, **kwargs):
            # 注意 self 是作为参数传进来的
            self.fuc1()
            func(self, *args, **kwargs)
            self.fuc2()
        return _func
    return _deco

class Foo(object):
    @decorator()
    def bar(self, a, b):
        # 输出 123
        print a, b
    def fuc1(self):
        print "before ..."
    def fuc2(self):
        print "after ... "




a = Foo()
a.bar(a='123', b='345')








